package com.xxwy.ddu.security.code.vaildatecode;

import com.xxwy.ddu.security.code.vaildatecode.ValidateCode;
import com.xxwy.ddu.security.code.vaildatecode.ValidateCodeType;
import org.springframework.web.context.request.ServletWebRequest;

import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;

/**
 * @author xxwy
 * on 2018/8/29 0029
 * 验证码的保存获取和移除，在两个模块中得到分开实现
 */
public interface ValidateCodeRepository {

    /**
     * 保留验证码
     * @param request
     * @param code
     * @param type
     */
    void save(ServletWebRequest request, ValidateCode code, ValidateCodeType type);

    /**
     * 获取验证码
     */
    ValidateCode get(ServletWebRequest request,ValidateCodeType type);

    /**
     * 移除验证码
     */
    void remove(ServletWebRequest request,ValidateCodeType type);
}
